// See LICENSE for license details.

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "platform.h"
#include <string.h>
#include "plic/plic_driver.h"
#include "encoding.h"
#include <unistd.h>
#include "stdatomic.h"


void draw(char *a)
{
  uint32_t mask=0;
  for(int i=0;i<8;i++)
      if(a[i]=='1')
          mask|=(1<<(i+1));
  GPIO_REG(GPIO_OUTPUT_VAL)=0;
  for(int i=0;i<100;i++)
  {
    GPIO_REG(GPIO_OUTPUT_VAL) ^= mask;
  }
}

int main(int argc, char **argv)
{

  
  uint32_t mask=0x01fe;
  uint32_t mask1=(1 << 1)|(1<<8);

  GPIO_REG(GPIO_OUTPUT_EN) |= mask;

  draw("00000000");
  draw("00000000");
  draw("00000000");
  draw("00000000");
  draw("00000000");
  draw("00000000");
  draw("00000000");
  draw("00000000");
  draw("00000000");
  draw("00000000");

  draw("11111111");
  draw("10010000");
  draw("10011000");
  draw("10010100");
  draw("01100010");
  draw("00000001");
  draw("00000000");
  draw("00000000");
  

  draw("10000001");
  draw("11111111");
  draw("10000001");
  draw("00000000");
  draw("00000000");

  draw("01110001");
  draw("10010001");
  draw("10010001");
  draw("10001001");
  draw("10001110");
  draw("00000000");
  draw("00000000");

  draw("00111100");
  draw("01000010");
  draw("10000001");
  draw("10000001");
  draw("10000001");
  draw("00000000");
  draw("00000000");

  draw("00001000");
  draw("00001000");
  draw("00001000");
  draw("00001000");
  draw("00000000");
  draw("00000000");

  draw("01100000");
  draw("00011000");
  draw("00000110");
  draw("00000001");
  draw("00000110");
  draw("00011000");
  draw("01100000");
  draw("00000000");


  
  return 0;

}
